package com.baize.baizeapp.utils

import kotlinx.coroutines.*

/**
 * 当前类注释: 协程扩展
 * <p>
 * Author : LeonWang <p>
 * Created: 2019/07/30.2:52 PM <P>
 * Description:
 * <p>
 * E-mail:lijiawangjun@gmail.com
 */

fun launchUI(block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Dispatchers.Main, block = block)

fun launchIO(block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Dispatchers.IO, block = block)

fun <T> asyncUI(block: suspend CoroutineScope.() -> T) = GlobalScope.async(Dispatchers.Main, block = block)

fun <T> asyncIO(block: suspend CoroutineScope.() -> T) = GlobalScope.async(Dispatchers.IO, block = block)